﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>经纪人管理-用户及权限设置-用户</title> <#include "../common/Resources.ftl"/>
<link
	href="http://192.168.0.42/resource/greensystem/css/module/config.css"
	rel="stylesheet" type="text/css" />


<script type="text/javascript"
	src="${base}/scripts/module/manage/PersonDetail.js"></script>
</head>
<body>
	<ddiv id="mainWraper" class="clearfix">
		<div class="detail-box config-detail-box">
			<div class="edit-box-hd ">
				<div class="tool">
					<div class="fl">
						<a class="mini-button " href="${ctx}/person/manager"><span
							class="mini-button-text">返回</span> </a>
					</div>
					<div class="fr">
						<div class="breadCrumb">
							您的位置：<a href="${ctx}/person/manager" target="_self">用户权限列表</a>
							&gt; <span class="current">查看详情 </span>
						</div>
					</div>
				</div>
			</div>
			<div class="edit-box-bd userPermission">
				<div class="module-box basicInfo-box">
					<h3 class="module-box-hd">
						<span class="titleIcon">基本信息</span>
					</h3>
					<div class="module-box-bd" style="height: 132px;">
						<div class="salesPeople-box">
							<div class="salesPeople-avatar">
								<img class="avatar-img" src="${person.photoUrl!''}" />
							</div>
							<div class="salesPeople-detailinfo">
								<ul>
									<li class="name">${person.name!''}<span class="title">${person.position.name!''}</span>
									</li>
									<li class="mobile">组织：${person.org.displayName!''}</li>
									<#if optCodes.ResouseMangage_UserManage_DetailAllowAllocateArea?? || loginPerson.number?index_of('admin')&gt;1>
									<#if person.position.name!="区域经理" && orgType!="JMSYB_NUMBER">
									<li class="mobile">版块权限：
									<#if person.isPlate==0>
									<a	href="javascript:void(0);" onclick="com.green.web.PersonDetail.isPlateUpdate(1);">允许</a>
								    <#else>
									<a	href="javascript:void(0);" onclick="com.green.web.PersonDetail.isPlateUpdate(0);">不允许</a>
								    </#if>
									</li>
									</#if>
									</#if>
								</ul>
							</div>
						</div>

					</div>
				</div>
				<!--城市区域分配 -->
				<div class="module-box   dutyCity-box">
					<h3 class="module-box-hd">
						<span class="titleIcon">城市区域分配</span>
						<#if optCodes.ResouseMangage_UserManage_DetailAllocateCity?? || loginPerson.number?index_of('admin')&gt;1>						
						 <a class="mini-button"
							href="javascript:void(0);" onclick="$('#areaUpdate').show();"><span
							class="mini-button-text">编辑</span> </a> 
						</#if>
							<#if orgType!="JMSYB_NUMBER">
							<#if optCodes.ResouseMangage_UserManage_DetailDeleteCity?? || loginPerson.number?index_of('admin')&gt;1>		
						   <a class="mini-button" href="javascript:void(0);"
							onclick="com.green.web.PersonDetail.deleteAreaPermission();"><span
							class="mini-button-text">移除板块</span> </a> 
							</#if>
							<#if person.isPlate==1 || person.position.name=='区域经理'>
							<a class="mini-button"
							href="javascript:void(0);"
							onclick="com.green.web.PersonDetail.updateBranch();"><span
							class="mini-button-text">更新业绩归属</span> </a> 
							</#if>
							</#if>
					</h3>
					<div class="module-box-bd">

						<div class="dutyCity">
							<div class="list">
								<ul>
									<li class="name">负责城市：<label id="cityN">${person.cityName!''}</label>
									</li> <#if orgType!="JMSYB_NUMBER">
									<li class="mobile">负责区域：<label id="areaN">${person.areaName!''}</label>
									</li> <#if person.isPlate==1 || person.position.name=='区域经理'>
									<li class="">负责板块：<label id="plateN">${person.plateName!''}</label>
									</li> </#if> </#if>
								</ul>
							</div>
						</div>
						<br />
						<div class="dutyCity edit-dutyCity" style="display: none;"
							id="areaUpdate">
							<div class="list">
								<ul>
									<input type="hidden" id="personId" value="${person.id!''}" />
									<li class="name">负责城市： <input
										class="input-text arrow_bottom" id="cityName" type="text"
										value="${person.cityName!''}"
										onclick="com.green.web.PersonDetail.getAreaList(this,'city',2); " />
										<input type="hidden" id="cityId" value="${person.cityIds!''}" />
									</li> <#if orgType!="JMSYB_NUMBER">
									<li class="mobile">负责区域： <input id="areaName"
										class="input-text arrow_bottom" type="text"
										value="${person.areaName!''}"
										onclick="com.green.web.PersonDetail.getAreaList(this,'area',3);" />
										<input type="hidden" id="areaId" value="${person.areaIds!''}" />
									</li><#if person.isPlate==1 || person.position.name=='区域经理'>
									<li class="module">负责板块： <input
										class="input-text arrow_bottom" id="plateName" type="text"
										value="${person.plateName!''}"
										onclick="com.green.web.PersonDetail.getAreaList(this,'plate',5);" />
										<input type="hidden" id="plateId"
										value="${person.plateIds!''}" /></li> </#if></#if>
								</ul>
								<ul>
									<li style="padding-left: 63px"><#if
										orgType=="JMSYB_NUMBER"> <a class="mini-button importantBtn"
										href="javascript:void(0);"
										onclick="com.green.web.PersonDetail.addAreaPermission(2);">
											<span class="mini-button-text">保存</span> </a> 
											<#else>											
											 <#if person.isPlate==1 || person.position.name=='区域经理'>
										        <a class="mini-button importantBtn" href="javascript:void(0);"
										         onclick="com.green.web.PersonDetail.addAreaPermission(5);">
											     <span class="mini-button-text">保存</span> </a> </#if>
											 <#if person.isPlate==0 && person.position.name!="区域经理" >
										       <a class="mini-button importantBtn" href="javascript:void(0);"
										        onclick="com.green.web.PersonDetail.addAreaPermission(3);">
											    <span class="mini-button-text">保存</span> </a> 
											  </#if>
											</#if> 
											<a	class="mini-button " href="javascript:void(0);"
										onclick="$('#areaUpdate').hide();"><span
											class="mini-button-text">取消</span> </a>
									</li>
								</ul>
							</div>

						</div>
					</div>
				</div>
				<!--//城市区域分配 -->
				<input type="hidden" id="longNumber"
					value="${controUnit.longNumber!''}" /> <input type="hidden"
					id="personId" value="${person.id!''}" />
				<!--数据查看权限 -->
				<div class="module-box  dataView-box relative">
					<h3 class="module-box-hd">
						<span class="titleIcon">数据查看权限</span> 
						<#if optCodes.ResouseMangage_UserManage_DetailDataAuthorityEdit?? || loginPerson.number?index_of('admin')&gt;1>							
						<a class="mini-button"
							href="javascript:void(0);"
							onclick="com.green.web.PersonDetail.selectOrg();"><span
							class="mini-button-text">编辑</span> </a>
							</#if>
						<#if optCodes.ResouseMangage_UserManage_DetailDeleteDataAuthority?? || loginPerson.number?index_of('admin')&gt;1>								
							 <a class="mini-button"
							href="javascript:void(0);"
							onclick="com.green.web.PersonDetail.deleteDataPermission();"><span
							class="mini-button-text">移除</span> </a>
						</#if>
					</h3>
					<div class="module-box-bd">
						<table width="100%" border="0" cellspacing="0" cellpadding="0"
							class="dataTable">
							<tr>
								<td><label id="dataName">${dataName!''}</label>
								</td>
							</tr>
						</table>
					</div>
				</div>
				<!--//数据查看权限 -->
			</div>
		</div>
		<div class="selectCity-pop" id="areadiv"
			style="position: ; display: none;" style="">
			<div class="city-hd">
				<ul class="clearFix">
					<li class="current"><a href="javascript:void(0)" id="">热门城市</a>
					</li>
				</ul>
			</div>
			<div class="city-bd">
				<ul class="clearfix" id="areaList">

				</ul>
			</div>
			<div class="city-ft">
				<a class="mini-button " href="javascript:void(0)"
					onclick="$('#areadiv').hide();"><span class="mini-button-text">完成</span>
				</a>
			</div>
		</div>
</body>
<script>
	function selectOrg(obj) {
		var orgList = "";
		var orgListName = "";
		for ( var i = 0; i < obj.length; i++) {
			if (orgList == "") {
				orgList = obj[i].id;
				orgListName = obj[i].name;
			} else {
				orgList = orgList + "," + obj[i].id;
				orgListName = orgListName + "," + obj[i].name;
			}
		}

		$.ajax({
			type : "POST",
			url : ctx + "/person/saveDataPermission",
			data : {
				"personId" : StringUtil.Url($("#personId").val()),
				"orgList" : orgList
			},
			success : function(date) {
				var ss = $.trim(date.message);
				if (ss == 1 || ss == "1") {
					if (orgListName == "") {
						orgListName = "个人";
					}
					$('#dataName').text(orgListName);
					art.dialog.optTips('您的操作已经成功', 3, "success");
				} else {
					art.dialog.optTips('操作失败，请稍后再试', 3, "failure");
				}
			}
		});
	}
</script>
</html>
